import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import echarts from "echarts";
Vue.prototype.$echarts = echarts;
Vue.use(ElementUI);
Vue.config.productionTip = false
//自定义标签实现按钮隐藏
Vue.directive('permission', {
  bind: (el, binding) => {
    //判断是否登录
    if (!localStorage.getItem("token")) {
      el.style.display = "none"
    } else {
      const dzJks = localStorage.getItem("dzJks").split(",")
      if (dzJks.indexOf(binding.value) == -1) {
        el.style.display = "none"
      }
    }
  }
})

//自定义标签实现菜单隐藏
Vue.directive('menu', {
  bind: (el, binding) => {
    //判断是否登录
    if (!localStorage.getItem("token")) {
      el.style.display = "none"
    } else {
      const menu_ids = localStorage.getItem("menu_ids")
      if (menu_ids.indexOf(binding.value) == -1) {
        el.style.display = "none"
      }
    }
  }
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
